﻿<UserControl 
    xmlns:views="clr-namespace:Acme.MVVM.Scenarios.Views"
    xmlns:interactionRequest="clr-namespace:Acme.Prism.InteractionRequest;assembly=Acme.Prism"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"  
    xmlns:prism="http://www.codeplex.com/prism" 
    x:Class="Acme.MVVM.Scenarios.Views.DialogInteractionRequestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="300">

    <Grid d:DataContext="{d:DesignInstance views:DialogInteractionRequestViewModel}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Margin="6" Text="Demonstrates displaying a dialog from a view model using the Prism InteractionRequest." FontSize="24" TextWrapping="Wrap" />

        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Button Padding="6,3" Margin="6,0" Content="Notification Dialog" Command="{Binding Path=NotificationDialogCommand}" />
            <Button Padding="6,3" Margin="6,0" Content="Confirmation Dialog" Command="{Binding Path=ConfirmationDialogCommand}" />
        </StackPanel>
        

        <i:Interaction.Triggers>
            <prism:InteractionRequestTrigger SourceObject="{Binding NotificationFromViewModelInteractionRequest}">
                <interactionRequest:InteractionDialogAction>
                    <interactionRequest:InteractionDialogAction.Dialog>
                        <interactionRequest:NotificationLocalModalInteractionDialog />
                    </interactionRequest:InteractionDialogAction.Dialog>
                    <interactionRequest:InteractionDialogAction.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Margin="6,0" Height="24" VerticalAlignment="Center" Source="/Acme.MVVM.Scenarios;component/Images/Information.png" />
                                <TextBlock Text="{Binding}" TextWrapping="Wrap" FontSize="14" VerticalAlignment="Center" />
                            </StackPanel>
                        </DataTemplate>
                    </interactionRequest:InteractionDialogAction.ContentTemplate>
                </interactionRequest:InteractionDialogAction>
            </prism:InteractionRequestTrigger>

            <prism:InteractionRequestTrigger SourceObject="{Binding ConfirmationFromViewModelInteractionRequest}">
                <interactionRequest:InteractionDialogAction>
                    <interactionRequest:InteractionDialogAction.Dialog>
                        <interactionRequest:ConfirmationLocalModalInteractionDialog />
                    </interactionRequest:InteractionDialogAction.Dialog>
                    <interactionRequest:InteractionDialogAction.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Margin="6,0" Height="24" VerticalAlignment="Center" Source="/Acme.MVVM.Scenarios;component/Images/Question.png" />
                                <TextBlock Text="{Binding}" TextWrapping="Wrap" FontSize="14" VerticalAlignment="Center" />
                            </StackPanel>
                        </DataTemplate>
                    </interactionRequest:InteractionDialogAction.ContentTemplate>
                </interactionRequest:InteractionDialogAction>
            </prism:InteractionRequestTrigger>

        </i:Interaction.Triggers>
    </Grid>
</UserControl>
